Skip to content

Conversation

@hvitved
Copy link
Contributor

@hvitved hvitved commented Nov 9, 2025

Extracted from #20770. Having the parent/child relation on raw elements is needed when one wants to refer to it in the definition of synthetic elements, to avoid empty or non-monotonic recursion.

DCA is uneventful.

@github-actions github-actions bot added Rust Pull requests that update Rust code Swift labels Nov 9, 2025
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Nov 10, 2025
@hvitved hvitved requested a review from redsun82 November 10, 2025 08:01
@hvitved hvitved marked this pull request as ready for review November 10, 2025 08:01
@hvitved hvitved requested review from a team as code owners November 10, 2025 08:01
Copilot AI review requested due to automatic review settings November 10, 2025 08:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds infrastructure for traversing parent-child relationships in the CodeQL Swift and Rust database schemas. The changes introduce helper methods to count indexed properties and get immediate children of elements.

Key Changes:

  • Added getNumberOf*() methods for all indexed properties to count elements
  • Added getImmediateChild() infrastructure to retrieve children by index
  • Added getSynthParent() method to get parents of synthetic elements
  • Updated code generation templates to produce the new helper methods

Reviewed Changes

Copilot reviewed 5 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
swift/ql/lib/codeql/swift/generated/Synth.qll Added getSynthParent() function and blank lines before doc comments for consistency
swift/ql/lib/codeql/swift/generated/Raw.qll Added getNumberOf*() methods for indexed properties and getImmediateChild*() functions for parent-child traversal
swift/ql/lib/codeql/swift/generated/ParentChild.qll Replaced max(int i | i = -1 or exists(...) | i) pattern with cleaner getNumberOf*() calls
misc/codegen/templates/*.mustache Updated templates to generate the new helper methods
swift/ql/.generated.list, rust/ql/.generated.list Updated checksums for regenerated files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@redsun82 redsun82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Also, nice simplification using getNumberOf... in ParentChild.qll 👍

@hvitved hvitved merged commit 74dd515 into github:main Nov 10, 2025
38 checks passed
@hvitved hvitved deleted the codegen/raw-child branch November 10, 2025 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code Swift

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants